<style>

    .popup-dialog.modal-dialog {
        width: 700px;
        top: 20px;
    }
    
    .ui-autocomplete.ui-front {
        z-index: 2000;
    }
</style>

<div id="send_message_dialog" class="popup-dialog modal-dialog">
    
    <form action="<?php echo $this->Html->url(array('action' => 'sendInstantMessage')); ?>" id="send_instant_form" method="post" class="form form-horizontal">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Send Instant Message</h4>
                <p class="text-sm">Enter your message below to send a message to selected contacts</p>
            </div>
            <div class="modal-body">
                <div class="form-group">
                    <div class="control-label col-lg-2">Member(s)</div>
                    <div class="controls col-lg-10">
                        <div id="MyPillbox" class="pillbox clearfix">
                            <ul>
                                <input type="text" placeHolder="Enter Member Name Or Number">
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="control-label col-lg-2">Message</div>
                    <div class="control-group col-lg-10">
                        <textarea id="send_instant_message" class="form-control input-sm" rows="3" maxlength="160" placeholder="Enter SMS Message Here" onkeyup="document.getElementById('charsleft').innerHTML = (160 - parseInt(this.value.length)) + ' Left';"></textarea>
                        <div id="charsleft" class="text-muted m-t-sm text-sm text-right">
                            160 Left
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="submit" id="send_instant_btn" class="btn btn-sm btn-info">Send SMS</button>
                <a href="#" id="sms_modal_dismiss" class="btn btn-sm btn-white" data-dismiss="modal">Cancel</a>
            </div>
        </div><!-- /.modal-content -->
    </form>
</div><!-- /.modal-dialog -->

<input type="hidden" id="contacts-autocomplete-url" value="<?php echo $this->Html->url(array('controller' => 'sms', 'action' => 'members_list')); ?>" />
<input type='hidden' id='instant_history_url' value='<?php echo $this->Html->url(array('action' => 'instant_history')); ?>' />

<?php if( isset($contacts) ) { ?>
<input type="hidden" id="preloaded_contacts" value='<?php echo json_encode($contacts); ?>' />
<?php } ?>